package com.example.starapp.parnterfrag;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;

import com.example.starapp.R;

public class ParnterFragment extends Fragment implements View.OnClickListener {
    Spinner boySp,girlSp;
    ImageView boyIv,girlIv;
    Button luckBtn,analysisBtn;
    String boyStar[]={"白羊座","金牛座","双子座","巨蟹座","狮子座","处女座","天秤座","天蝎座","射手座","摩羯座","水瓶座","双鱼座"};
    String girlStar[]={"白羊座","金牛座","双子座","巨蟹座","狮子座","处女座","天秤座","天蝎座","射手座","摩羯座","水瓶座","双鱼座"};
    ArrayAdapter<String> boyAdapter;
    ArrayAdapter<String> girlAdapter;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view=inflater.inflate(R.layout.fragment_parnter, container, false);
        boyIv=view.findViewById(R.id.parnter_boy_iv);
        girlIv=view.findViewById(R.id.parnter_girl_iv);
        boySp=view.findViewById(R.id.parnter_boy_sp);
        girlSp=view.findViewById(R.id.parnter_girl_sp);
        luckBtn=view.findViewById(R.id.parnter_btn_luck);
        analysisBtn=view.findViewById(R.id.parnter_btn_Analysis);
        boyAdapter = new ArrayAdapter<String>(getContext(), R.layout.item_sp, R.id.item_sp_tv, boyStar);
        boySp.setAdapter(boyAdapter);
        girlAdapter = new ArrayAdapter<String>(getContext(), R.layout.item_sp, R.id.item_sp_tv, girlStar);
        girlSp.setAdapter(girlAdapter);

        return view;

    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.parnter_btn_luck://跳转到抽奖页面
                break;
            case R.id.parnter_btn_Analysis://跳转到配对页面

                break;
        }
    }
}
